package smartcrud.spring.models.rbac;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import smartcrud.common.orm.Page;
import smartcrud.common.orm.PropertyFilter;

@Service
public class MenuServiceJdbcImpl implements MenuService {
	@Autowired
	private MenuDao menuDao;

	@Override
	public Menu createMenu(Menu o) {
		return menuDao.createMenu(o);
	}

	@Override
	public void deleteMenu(Long id) {
		menuDao.deleteMenu(id);
	}

	@Override
	public void updateMenu(Menu o) {
		menuDao.updateMenu(o);
	}

	@Override
	public Menu findMenuById(Long id) {
		return menuDao.findMenuById(id);
	}
	
	@Override
	public List<Menu> findTopLevelMenus() {
		return menuDao.findTopLevelMenus();
	}
	
	@Override
	public List<Menu> findAllMenus() {
		return menuDao.findAllMenus();
	}

	@Override
	public Page<Menu> findByPage(Page<Menu> page, final List<PropertyFilter> filters) {
		return menuDao.findByPage(page,filters);
	}
	
	@Override
	public void updateMenuOrder(List<Menu> menus) {
		menuDao.updateMenuOrder(menus);
	}

	@Override
	public int count() {
		return menuDao.count();
	}
}
